﻿<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>林西客资管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  
  <link rel="stylesheet" href="../layui/css/layui.css"  media="all">
  <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-header">
    <div class="layui-logo">林西客服团队管理系统</div>
    <!-- 头部区域（可配合layui已有的水平导航） -->
    <ul class="layui-nav layui-layout-right">
      <li class="layui-nav-item">
        <a href="javascript:;">
          <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
          <div id="userName" class="layui-inline">
            未登录
          </div>
          
        </a>
        <dl class="layui-nav-child">
          <dd><a href="">基本资料</a></dd>
          <dd><a href="">安全设置</a></dd>
        </dl>
      </li>
      <li class="layui-nav-item"><a href="" id="loginZhuXiao">退了</a></li>
    </ul>
  </div>
  
  <div class="layui-side layui-bg-black">
    <div class="layui-side-scroll">
      <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
      <ul class="layui-nav layui-nav-tree"  lay-filter="test" id="leftNav">
        <li class="layui-nav-item layui-nav-itemed"><a href="javascript:;" data-name="customer_pool">客资池</a></li>
        <li class="layui-nav-item"><a href="javascript:;" data-name="Agent_data_report">坐席数据报表</a></li>
        <li class="layui-nav-item"><a href="javascript:;" data-name="AB_customer_capital">AB库客资</a></li>
        <li class="layui-nav-item" data-name="customer_monitoring"><a href="javascript:;">客资监听</a></li>
      </ul>
    </div>
  </div>
  
  <div class="layui-body">
    <!-- 内容主体区域 -->
    <div style="padding: 15px;width:100%;height: 100%;">
    	<iframe id="iframeMain" style="width:100%;height: 100%;border:none;";  src=""></iframe>
    </div>
  </div>
  
  <div class="layui-footer">
    <!-- 底部固定区域 -->
    © layui.com - 底部固定区域
  </div>
</div>

<script src="../layui/layui.all.js"></script>
<script type="text/javascript" src="../../disanfanglogin/vendor/jquery/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../js/linxi.js?type=5"></script>
<script>
//JavaScript代码区域

$(document).ready(function(){


   var element = layui.element;


  linxi.loginYanZheng(function(data){


    console.log(data)

    $('#userName').html(data.data.username)

    $('#loginZhuXiao').click(function(e){  //注销登录
        linxi.loginZhuXiao(function(data){
          console.log(data)
        })
    })


    var user_root = data.data.user_root



    $li='';

    var navHtmlName={
      
        'customer_pool':{"name":"客资池","path":"table.html"},
        'Agent_data_report':{"name":"坐席数据报表","path":"kefustatus.html"},
        'AB_customer_capital':{"name":"AB库客资","path":"ABku.html"},
        'customer_monitoring':{"name":"客资监听","path":"kefuFenPei.html"},
    }

    for(key in user_root){

      if(key!=='on_the_job'){

        if(user_root[key]==1){

          $li += `<li class="layui-nav-item layui-nav-itemed"><a href="javascript:;" data-name="${key}">${navHtmlName[key]['name']}</a></li>`

        }
      }

    }


    $('#leftNav').html($li)

    element.render('nav'); //重载导航元素
   


    element.on('nav(test)',function(elem){

     
      var navName = $(elem.context).data()['name']

      layer.msg(elem.text());

      $('#iframeMain')[0].src=navHtmlName[navName]['path']


    })

  })


  



})





</script>
</body>
</html>